#include "Platform.h"
#include "RSManager.h"
#include "Box.h"
#include "Sprite.h"
#include "GameDefine.h"
Platform::Platform(Box* box , STATIC_ID id): StaticObject(box, id)
{
	_initpos=box->_position;
}
//comment comment

Platform::~Platform(void)
{
}
void Platform::init()
{
	_sprite= RSManager::getInstance()->getSprite(MOVE_PLATFORM);
	delay=0;
}

void Platform::update()
{
	delay+=GAME_TIME;
	if (delay>60)
	{
		delay =0;
		if(_box->_position.x>= _initpos.x + _box->_size.x )
			_box->_v.x= -8;
		if(_box->_position.x<=_initpos.x)
			_box->_v.x =8;
		_box->_position.x+=_box->_v.x;;
	}
	
}

void Platform::render()
{
	_sprite->Render(_box->_position);
}
Box* Platform:: getCollisionBox()
{
	_colBox->_position=_box->_position;
	_colBox->_size= D3DXVECTOR2(64,62);
	_colBox->_v =_box->_v;
	return _colBox;
}